perm filename ENCODE.WEB[MF,ALS] blob
sn#760294 filedate 1984-07-01 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002
C00004 ENDMK
C⊗;
@<Encode the glyph@>=
if glyph_ptr[char_code]≠0 then error('Duplicate glyph');
glyph_ptr[char_code]←oc_byte_no div 4;
glyph_bits[char_code]←cols*rows;
glyph_words[char_code]←(glyph_bits[char_code]+15) div 16;
@!eebug
print_nl; @<Print the image@>;
gubee@/
x←min_x;
while (x≤max_x) do
begin
y←min_y;
while y≤max_y do
begin
if y<(max_y-7) then @<get full byte@> else @<get mixed byte@>;
oc_byte(b);
end;
incr(x);
end;
if oc_byte mod 2 ≠ 0 then oc_byte(0);
@ @<Get full byte@>=
begin
b←image; incr(y);
for i←2 to 8 do
begin
b←b*2+image;
incr(y);
end;
end
@ @<Get mixed byte@>=
begin b←image; incr(y); i:=2;
while y≤max_y do
begin b:=b*2+image; incr(y); incr(i);
end;
incr(x)
if x≤max_x then
begin y←min_y; {start the next row}
for i←i to 8 do
begin b←b*2 + image; incr(y);
end
end
else for i←i to 8 do b←b*2; {with x>max_x and y>max_y to end encoding}
end
@ @<Glob...@>=
@!glyph_bits: array [0..max_glyph_no] of integer;
@!glyph_words: array [0..max_glyph_no] of integer;